<?php
session_start();
	
	$host="localhost";
	$username="root";
	$password="";
	$database="cs4400_group17";

	mysql_connect($host,$username,$password);
	@mysql_select_db($database) or die( "Unable to select database");
	
	$username = $_SESSION['userName'];
	$useremail = $_SESSION['userEmail'];
	
	$corkTitle = $_POST['corkTitle'];
	$ppURL = $_POST['ppURL'];
	$OEmail = $_POST['OwnerEmail'];
	$text =  $_POST['Comment'];	
	$DT = date("Y-m-d H:i:s");
	
	
	
	$sql = "INSERT INTO comments VALUES('$useremail','$DT','$OEmail','$corkTitle','$ppURL','$text')";
	$result = mysql_query($sql);
	if(!$result){
		print "insert failed";
		echo $corkTitle;
		echo $ppURL;
		echo $OEmail;
		echo $text;	
	}
	else{
		print "success";
	}
	
	
	header("location:home.php");
?>